package org.codetranslators.compiler.tiger.abssyntree;


public class OpExp extends Exp {
	
	public final static int PLUS=0;
	public final static int MINUS=1;
	public final static int MUL=2;
	public final static int DIV=3;
	public final static int EQ=4;
	public final static int NE=5;
	public final static int LT=6;
	public final static int LE=7;
	public final static int GT=8;
	public final static int GE=9;
	public final static int AND=10;
	public final static int OR=11;
	
    private Exp left, right;
    private int oper;
   
   public OpExp(int p, Exp l, int o, Exp r) 
   {
	   pos = p; 
	   left = l; 
	   oper = o; 
	   right = r;
   }
   
   public Exp getLeft()
   {
	   return left;
   }
   
   public Exp getRight()
   {
	   return right;
   }
   
   public int getOper()
   {
	   return oper;
   }
   
   public String getOperator()
   {
	   if(oper == OpExp.PLUS)
		   return "+";
	   else if(oper == OpExp.MINUS)
		   return "-";
	   else if(oper == OpExp.MUL)
		   return "*";
	   else if(oper == OpExp.DIV)
		   return "/";
	   else if(oper == OpExp.AND)
		   return "&";
	   else if(oper == OpExp.OR)
		   return "|";
	   else if(oper == OpExp.EQ)
		   return "=";
	   else if(oper == OpExp.NE)
		   return "<>";
	   else if(oper == OpExp.LE)
		   return "<=";
	   else if(oper == OpExp.GT)
		   return ">";
	   else if(oper == OpExp.LT)
		   return "<";
	   else if(oper == OpExp.GE)
		   return ">=";
	   else return " ";
   }
   
}
